/*
 * @Description: 商城API接口
 * @Author: GGB
 * @Date: 2021-12-27 09:34:45
 * @LastEditors: GGB
 * @LastEditTime: 2022-01-25 10:26:42
 */

import { StoreListGetResultModel, StoreParams, DeleteStoreParams } from './model/storeModel';
import { defHttp } from '/@/utils/http/axios';

import { BasicPageParams, BasicResult } from '../model/baseModel';

enum Api {
  StoreList = '/store/index',
  AddStore = '/store/add',
  EditStore = '/store/edit',
  DeleteStore = '/store/delete',
  AddRecovery = '/store/recovery',
  RecoveryList = '/store/recycle',
}
/**
 * 获取商城列表
 */
export const getStoreList = (params: BasicPageParams) =>
  defHttp.get<StoreListGetResultModel>({ url: Api.StoreList, params });

/**
 * 新增商城
 */
export const addStore = (params: StoreParams) =>
  defHttp.post<BasicResult>({ url: Api.AddStore, params });

/**
 * 编辑商城
 */
export const editStore = (params: StoreParams) =>
  defHttp.post<BasicResult>({ url: Api.AddStore, params });

/**
 * 删除商城
 */
export const deleteStore = (params: DeleteStoreParams) =>
  defHttp.post<BasicResult>({ url: Api.DeleteStore, params });

/**
 * 获取商城列表
 */
export const getRecoveryList = (params: BasicPageParams) =>
  defHttp.get<StoreListGetResultModel>({ url: Api.RecoveryList, params });

/**
 * 商城移入回收站
 */
export const addRecovery = (params: DeleteStoreParams) =>
  defHttp.post<BasicResult>({ url: Api.AddRecovery, params });
